
#include <netinet/in.h>

#include <string>
using namespace std;

#ifndef INETADDRESS_HPP
#define INETADDRESS_HPP

namespace tulun
{
    class InetAddress
    {
    private:
        struct sockaddr_in addr_;

    public:
        InetAddress();
        InetAddress(const std::string &ip, const short port);
        InetAddress(const struct sockaddr_in &addr);

        void setIp(const std::string &ip);
        void setPort(const short port);

        std::string toIp() const;
        std::string toIpPort() const;
        std::uint16_t toPort() const;
        const struct sockaddr_in &getSockAddrInet() const;
        void setSockAddrInet(const struct sockaddr_in &addr);

        uint32_t ipNetEndian() const;
        uint16_t portNetEndian() const;
    };
} // namespace tulun

#endif